#include "ModelDialog.h"
#include "../../utils/CoordinateUtil.h"


ModelDialog::ModelDialog(void)
	:m_pMenu(NULL),m_bTouchedMenu(false)
{
}

ModelDialog::~ModelDialog(void)
{
}

void ModelDialog::popup(float offsetX, float offsetY)
{
	Dialog::popup();
    masks->removeFromParentAndCleanup(true);
	modelDialogLayer->addChild(masks);
	modelDialogLayer->addChild(this);
	this->setPosition(offsetX,offsetY);
}

void ModelDialog::close()
{
	Dialog::close();
	modelDialogLayer->removeChild(this, false);
	CCArray* nodes = modelDialogLayer->getChildren();
	int childrenCount = modelDialogLayer->getChildrenCount();
	if (childrenCount >= 2)
	{
		masks->removeFromParentAndCleanup(true);
		modelDialogLayer->addChild(masks, 0);
		Dialog* dialog = (Dialog*)(nodes->objectAtIndex(childrenCount-2));
		dialog->setTarget();
	}
	else
	{
		modelDialogLayer->removeChild(masks, false);
	}
}

void ModelDialog::init()
{
	
}

void ModelDialog::onEnter()
{
	Dialog::onEnter();
}

void ModelDialog::onExit()
{
	Dialog::onExit();
}
